

        <?php
        for ($i = 0; $i < $term0num; $i++) {
            ?>


            <li>
                <input type="checkbox" name="termcheckbox[]" value="<?php echo $term0_nid[$i] ?>"

                    <?
                    if (compare_term($term0_nid[$i], $relation_term_nid)) {
                        echo "checked='checked'";
                    }
                    ?>
						title="<?php echo $term0_name[$i] ?>"
                    />

               
            </li>



            <?

            $query2 = mysql_query("SELECT COUNT(nid) FROM $table where term1 = $term0_nid[$i] && interm = 'term1' and belong ='$sys_belong' ");
            $term1sum = mysql_result($query2, 0);


            $result1 = mysql_query("select * from $table where term1 = $term0_nid[$i] && interm = 'term1' and belong ='$sys_belong' ORDER BY $sort_by desc");

            while ($row = mysql_fetch_array($result1)) {
                {
                    $term1_nid[$i][] = $row['nid'];
                    $term1_name[$i][] = $row['name'];
                }
            }

            ?>



            <?php
            for ($ii = 0; $ii < $term1sum; $ii++) {
                ?>


                <li>
                    <input type="checkbox" name="termcheckbox[]" value="<?php echo $term1_nid[$i][$ii] ?>"

                        <?
                        if (compare_term($term1_nid[$i][$ii], $relation_term_nid)) {
                            echo "checked='checked'";
                        }
                        ?>

						title="<?php echo $term0_name[$i] ?> / <?php echo $term1_name[$i][$ii] ?>"
                        />
                    
                </li>



                <?

                $term1idnow = $term1_nid[$i][$ii];


                $query = mysql_query("SELECT COUNT(nid) FROM $table where term2= $term1idnow && interm = 'term2' and belong ='$sys_belong' ");
                $term2sum = mysql_result($query, 0);


                $result = mysql_query("select * from $table where term2= $term1idnow && interm = 'term2' and belong ='$sys_belong' ORDER BY $sort_by desc");


                while ($row = mysql_fetch_array($result)) {
                    $term2_nid[$i][$ii][] = $row['nid'];
                    $term2_name[$i][$ii][] = $row['name'];


                }

                ?>



                <?php
                for ($iii = 0; $iii < $term2sum; $iii++) {

                    ?>


                    <li>
                        <input type="checkbox" name="termcheckbox[]" value="<?php echo $term2_nid[$i][$ii][$iii] ?>"
                            <?
                            if (compare_term($term2_nid[$i][$ii][$iii], $relation_term_nid)) {
                                echo "checked='checked'";
                            }
                            ?>
                            title=" <?php echo $term0_name[$i] ?> / <?php echo $term1_name[$i][$ii] ?>/<?php echo $term2_name[$i][$ii][$iii] ?>"
                            />
                       


                    </li>



                    <?php
//3级目录循环结束符	
                }
                ?>








                <?php
//2级目录循环结束符	
            }
            ?>












            <?php
//一级目录循环结束符	
        }
        ?>

